﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LeetCodeSolutions
{
    /// <summary>
    /// 27. 移除元素
    /// </summary>
    class LeetCode27 : LeetCodeBase
    {
        public override void Execute()
        {
            throw new NotImplementedException();
        }

        public int RemoveElement(int[] nums, int val)
        {
            if (nums.Length == 0 || nums == null)
            {
                return 0;
            }

            int temp = 0;//移位标记
            for (int i = 0; i < nums.Length; i++)
            {
                if (nums[i] != val)
                {
                    nums[temp++] = nums[i];

                }
            }

            return temp;
        }
    }
}
